import { createStore } from "vuex";
import db from "../utils/localStorage";

const store = createStore({
  state: {
    return: {
      userInfo: db.get("userInfo", null),
      isPublished: false,
      recognizeData: null,
    },
  },
  mutations: {
    setUserInfo(state, data) {
      db.save("userInfo", data);
      state.userInfo = data;
    },
    setIsPublished(state, isPublished) {
      state.isPublished = isPublished;
    },
    setRecognizeData(state, data) {
      state.recognizeData = data;
    },
  },
});

export default store;
